package transaction.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import transaction.entity.Tc;
import transaction.entity.TcExample;
import transaction.repository.TcMapper;
import transaction.service.TcService;

import java.util.List;

@Service
public class TcServiceImpl implements TcService {

    @Autowired
    private TcMapper tcMapper;

    @Override
    public List<Tc> findAll(String shard) {
        TcExample tcExample = new TcExample();
        tcExample.createCriteria();
        return tcMapper.selectByExample(tcExample);
    }

    @Override
    public List<Tc> findAllBySplitTable(String shard) {
        TcExample tcExample = new TcExample();
        tcExample.createCriteria();
        return tcMapper.selectByTableName("1");//查询分表
    }

    @Override
    public int insert(Tc t) {
        tcMapper.insert(t);
        if(tcMapper!=null){
            throw new RuntimeException();
        }
        return 1;
    }

}
